import {resetForm} from 'plugins/utils.js'

export function loadSucess (state, payload) {
  state.fields = payload
  state.loading.hide()
}

export function reset (state) {
  state.fields = {}
  resetForm(state.msg)
}

export function saveSuccess (state) {
  state.loading.hide()
  this.$router.push('/listips')
}

export function saveFail (state, payload) {
  state.loading.hide()
  for (var name in payload) {
    state.msg[name] = payload[name][0]
  }
}

export function clearBoth (state) {
  state.fields.host = []
  state.selectedHost = []
}
